package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 
 * </p>
 *
 * @author cnswhy
 * @since 2020-11-13
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_page_content")
@ApiModel(value = "PageContent", description = "")
@AllArgsConstructor
public class PageContent extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "")
    @NotEmpty(message = "不能为空")
    @Length(max = 100, message = "长度不能超过100")
    @TableField(value = "title", condition = LIKE)
    @Excel(name = "")
    private String title;

    @ApiModelProperty(value = "")
    @NotEmpty(message = "不能为空")
    @Length(max = 16777215, message = "长度不能超过16777215")
    @TableField("content")
    @Excel(name = "")
    private String content;

    @ApiModelProperty(value = "")
    @TableField("create_date")
    @Excel(name = "", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createDate;

    /**
     * 1商家入驻协议2注册协议3用户须知4-达人介绍
     */
    @ApiModelProperty(value = "1商家入驻协议2注册协议3用户须知4-达人介绍")
    @TableField("type")
    @Excel(name = "1商家入驻协议2注册协议3用户须知4-达人介绍")
    private Integer type;


    @Builder
    public PageContent(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    String title, String content, LocalDateTime createDate, Integer type) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.title = title;
        this.content = content;
        this.createDate = createDate;
        this.type = type;
    }

}
